# -*- coding:utf-8 -*-
"""
Author：Administrator
Date:2021年08月18日
"""
from docx import Document
from docx.shared import Cm

# file = Document('./练习/练习4.docx')
# run = file.tables[0].cell(0, 0).paragraphs[0].add_run()
# run.add_picture('./练习/赵丽颖.jpg', width=Cm(5), height=Cm(3))
#
# # file.add_picture('./练习/赵丽颖.jpg',width=Cm(13), height=Cm(8))
# file.save('./练习/练习4结果2.docx')

# 删除图片
file = Document("./练习/练习5.docx")
para = file.paragraphs[1]
print("删除前图片数量",len(file.inline_shapes))
para.clear()
print("删除后图片数量",len(file.inline_shapes))

